<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //利用字面量的形式创建对象
        var computer = {
            price: 2000,
            brand: '华为',
            method1: function() {
                console.log('打游戏');
            },
            method2: function() {
                console.log('好好学习');
            }
        }

        console.log(computer);


        var fridge = {
            brand: '格力',
            price: 9000,
            width: 300,
            height: 90000,
            use: function() {
                console.log('开门关门 冷冻');
            }
        }
        console.log(fridge);

        var xiaoming = {
            name: 'xiao',
            age: 18,
            school: '北京大学',
            cla: 1901,
            sisters: [' 小学', '张三'],
            eat() {
                console.log('面条');
            },
            play: function() {
                console.log('王者荣耀');
            }
        }
        console.log(xiaoming);

        //创建一个圆 求周长和面积
        var circle = {
            r: 10,
            l() {
                return 2 * Math.PI * r;
            },
            s() {
                return Math.PI * Math.pow(r, 2);
            }
        };

        console.log(circle);
    </script>
</body>

</html>